﻿^l::
; execute line or current selection in Matlab
    IfWinActive, ahk_class Vim
    {
        ; CTRL-E is mapped to a Vim shortcut to yank the text you want
        Send, ^e
        WinActivate, ahk_class SunAwtFrame  
        Send, ^0^v{Enter}
        WinActivate, ahk_class ahk_class Vim
    } else if WinActive, ahk_class SunAwtFrame  
    {
        Send, ^0^v{Enter}
    } 
Return 


^r::
;; execute currnt file in vim
    IfWinActive, ahk_class Vim
    {
        ; CTRL-f is mapped to a Vim shortcut to yank the text you want
        Send, ^f
        WinActivate, ahk_class SunAwtFrame  
        Send, ^0^v{Enter}
        Send, ^a
        Send, ^{Insert}
        WinActivate, ahk_class ahk_class Vim
        Send, :MatlabPrintResult{Enter}
    } else if WinActive, ahk_class SunAwtFrame  
    {
        Send, ^0^v{Enter}
    } 
Return 


F3::
WinActive("A")
ControlGetFocus, my_Control
ControlGet, my_Text, Selected,, %my_Control%
MsgBox % "my_Text = " . my_Text
Return
